<template>
  <div>
    <div>index 111</div>
    <p>{{navs}}</p>
    <div><router-link to="/sirius/hello">sirius</router-link></div>
    <el-button size="small" type="danger" @click="logout">注销</el-button>
    <el-button size="small" type="primary" @click="setNavs(nav)">导航1</el-button>
  </div>
</template>

<script>
import { mapGetters, mapActions } from 'vuex'

export default {
  data () {
    return {
      nav: {
        left: 'index',
        top: 'prod'
      }
    }
  },
  computed: mapGetters({
    navs: 'getNavs'
  }),
  name: 'Index',
  methods: {
    logout () {
      let _this = this
      this.$http.get('/logout')
        .then(function (response) {
          if (response.success) {
            _this.$router.push('/login')
          } else {
            _this.$alert('注销失败，' + response.data.resultMessage, '提示信息', {
              confirmButtonText: '确定',
              type: 'error'
            })
          }
        })
    },
    ...mapActions([
      'setNavs'
    ])
  }
}
</script>

<style scoped>

</style>
